<?php
	session_start();	
?>

<?php
	if( $_SESSION["admin"] != "" )
	{
?>
<a href="index.php?com=categoryproduct"><b>List categoryproduct</a></b> | <b><a href="index.php?com=categoryproduct&func=add">Add new categoryproduct</b></a>
<br />
<?php 
	include_once("process/categoryproduct.php");
	$categoryproduct = new categoryproduct();
    if( isset($_POST['btnAdd']) )
	{	
			$CategoryID = stripcslashes($_POST["CategoryID"]);
    		$ProductID=stripcslashes($_POST["ProductID"]);
            if($CategoryID != "" && $CategoryID != 0 && $ProductID != "" && $ProductID != 0)
            {
        		$categoryproduct->AddCategoryProduct($CategoryID, $ProductID);	
        		echo '<meta http-equiv="Refresh" content="0;URL=index.php?com=categoryproduct" />';
        		return;
            }
	}
?>

<form method="post" action="index.php?com=categoryproduct&func=add" id="contactform" name="addcountry">
	<table width="70%" style="font-size:10pt;">
		<tr>
			<td align="center" colspan="2" height="50"><b style="font-size:12pt; color:Blue;">Add new category_product</b></td>
		</tr>
		<tr height="26">
			<td align="right" width="120px">Category :&nbsp;&nbsp;
			</td>
			<td width="140px">
            <input type="text" class="validate[required]" name="CategoryID" id="CategoryID"/><font style="color: red;"> *</font>
			</td>
        </tr>
        <tr>
			<td align="right" width="120px">Product :&nbsp;&nbsp;</td>
			<td><input type="text" class="validate[required]" name="ProductID" id="ProductID" /><font style="color: red;"> *</font></td>
		</tr>  	    
		<tr>
			<td></td>
			<td colspan="2" align="left" height="40">
				<input type="submit" name="btnAdd" id="btnAdd" value="Add"  />
				<input type="reset" value="Reset" />
			</td>
		</tr>
	</table>
</form>
<i>Please fill in these fields (<font style="color: red;">*</font>)</i>
<?php
    }
   else
	{
		echo "<meta http-equiv='refresh' content='0; url=login.php' />";
	}
?>